{echo:JS::import("form")}
{echo:JS::import('dialog?skin=tinysimple');}
<link type="text/css" rel="stylesheet" href="{url:#css/ucenter.css}"/>
<script type="text/javascript" charset="UTF-8" src="{url:#js/jquery.iframe-post-form.js}"></script>
<div class="container clearfix">
    {widget:name=sub_navs action=ucsidebar sidebar=$sidebar act=$actionId}
    <div class=" clearfix uc-content">
        <h1 class="title"><span>用户中心：</span></h1>
        <dl class="ucenter-index clearfix">
            <dt class="sub-1 clearfix">
                {if:$user['head_pic']==''}
                <img id="head-pic" class="ie6png" src="{url:#images/no-img.png}" width="120" height="120">
                {else:}
                <img id="head-pic" class="ie6png" src="{url:@$user[head_pic]}" width="120" height="120">
                {/if}
            <p style="padding: 10px 30px;"><a href="javascript:;" id="upload-link">修改头像</a></p>
            </dt>
            <dd class="sub-2">
                <table width="100%" class="simple">
                    <tr>
                        <td colspan="2"><b>{$user['name']}</b>，欢迎你！</td>

                        <td colspan="2"><span class="fr">最后一次登录：{$user['login_time']}</span></td>
                    </tr>
                    <tr>
                        <td>
                            推荐人
                        </td>
                        <td>{echo:Common::get_tjr_name($user['tjr_id'])['name']}
                        </td>
                        <td>
                            剩余分红
                        </td>
                        <td>{$customer['last_fhjf']}
                        </td>
                    </tr>
                    <tr>
                        <td>
                            订单交易总金额
                        </td>
                        <td>{$currency_symbol}{echo:sprintf("%01.2f",$order['amount'])}
                        </td>

                        <td>进行中的订单</td>
                        <td>{$order['pending']}</td>

                    </tr>

                    <tr>
                        <td>注册分</td>
                        <td>{$customer['zcf']}</td>
                        <td>奖金分</td>
                        <td>{$customer['jjf']}</td>
                    </tr>
                    <tr>
                        <td>现金分</td>
                        <td>{$customer['xjf']}</td>
                        <td>购物积分</td>
                        <td>{$customer['gwjf']}</td>
                    </tr>
                    <tr>
                        <td>重消积分</td>
                        <td>{$customer['cxjf']}</td>
                        <td>资产</td>
                        <td>{$customer['zc']}</td>
                    </tr>
                    <tr>
                        <td>投资级别</td>
                        <td>
                            {if:$customer['group_id'] == 0}
                            无
                            {elseif:$customer['group_id'] == 1}
                            一级代理
                            {elseif:$customer['group_id'] == 2}
                            二级代理
                            {elseif:$customer['group_id'] == 3}
                            县代理
                            {elseif:$customer['group_id'] == 4}
                            市代理
                            {/if}
                        </td>
                        <td>代理区域</td>
                        <td>{echo:Common::area_name($customer['dl_area'])}</td>
                    </tr>
                    <!--<tr>-->
                    <!--<td>累计释放</td>-->
                    <!--<td>{$user['sf_xfjf']}</td>-->
                    <!--<td>团队业绩</td>-->
                    <!--<td>{$user['tuan_yj']}</td>-->
                    <!--</tr>-->
                    <!--<tr>-->
                    <!--<td>云积分：{$user['cloud_point']}</td>-->
                    <!--<td colspan="3">-->
                    <!--分享链接: &nbsp;<a target="blank" href="{url:/simple/reg/num/$user[number]}">-->
                    <!--http://www.ahcysc.com/index.php?con=simple&act=reg&num={$user[number]} -->
                    <!--</a><label style="font-size:12px;">(右键复制链接地址)</label>-->
                    <!--</td>-->
                    <!--</tr>-->
                    <!--
                    <tr>
                        <td width="50%">账户余额：{$currency_symbol}{$customer['balance']}</td>
                        <td width="50%">订单交易总金额：{$currency_symbol}{echo:sprintf("%01.2f",$order['amount'])}</td>
                    </tr>
                    <tr>
                        <td>可用积分：{$customer['ok_xfjf']}</td>
                        <td>会员类型：{echo:Common::getShenfenName($customer['u_lx'])}&nbsp;&nbsp;<span class='red'>{echo:Common::getAgentName($customer['dl_lx'])}</span>&nbsp;&nbsp;{echo:$customer['lgd_ok']>0?Common::getShenfenName($customer['lgd_ok']):"";}&nbsp;&nbsp;{echo:$customer['gd_ok']>0?Common::getShenfenName($customer['gd_ok']):"";}</td>
                    </tr>
                    <tr>
                        <td>消费券:{$customer['voucher']}</td>
                        <td>推荐编码：{$customer['number']}</td>
                    </tr>
                    -->
                    <!--
                    <tr>
                        <td>进行中的订单：{$order['pending']} </td>
                        <td>待评价的商品：{$comment['num']}</td>
                    </tr>
                    -->
                </table>
            </dd>
        </dl>
    </div>
</div>
<div id="head-dialog" style="display: none">
    <div class="box" style="width:400px;">
        <h2>上传头像：</h2>
        <div class="content mt20 p10">
            <form enctype="multipart/form-data" action="{url:/ucenter/upload_head}" method="post" id="uploadForm">
                <p><input type="file" name="imgFile"></p>
                <p class="mt20 tc">
                    <button class="btn" id="upload-btn">上传</button>
                </p>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $("#upload-link").on("click", function () {
        art.dialog({id: 'head-dialog', lock: true, content: document.getElementById('head-dialog')});
    });

    $("#uploadForm").iframePostForm({
        iframeID: 'iframe-post-form',
        json: true,
        post: function () {
            $("#upload-btn").text("上传中...")
        },
        complete: function (data) {
            if (data['error'] == 1) {
                alert(data['message']);
            } else {
                var root_url = "{url:@}"
                $("#head-pic").attr("src", root_url + data['url'] + '?i=' + Math.random());
                art.dialog({id: 'head-dialog'}).close();
            }
            $("#upload-btn").text("上传");
        }
    });
</script>
